<template>
  <div>
   
    <el-table :data="tableData" style="width: 100%">
      <el-table-column label="班级名称" width="180" show-overflow-tooltip>
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.cname }}</span>
        </template>
      </el-table-column>

      <el-table-column label="开班时间" width="150">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <el-tag size="medium">{{ 
               new Date(scope.row.createTime).toLocaleString()
              }}</el-tag>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="分班时间" width="150">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper">
            <el-tag size="medium">{{ 
               new Date(scope.row.div_class).toLocaleString()
              }}</el-tag>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="文理分科" width="150">
        <template slot-scope="scope">
          <div slot="reference" class="name-wrapper" v-if="scope.row.status == 0">
            <el-tag size="medium">
              暂未分班
            </el-tag>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
            size="mini"
            @click="divTime(scope.$index, scope.row)"
          >指定分班时间
          </el-button> 
        </template>
      </el-table-column>
     </el-table>

    <!-- 分页组件 -->
    <el-pagination
      @next-click="next"
      @prev-click="prev"
      :current-page="currentPage"
      :page-sizes="[8]"
      :page-size="size"
      layout="total, sizes, prev, pager, next"
      :total="total"
    >
    </el-pagination>
  </div>
</template>
<script>
import axios from "axios";
import commons from "../../../assets/commons";
export default {
  data() {
    return {
      currentPage: 1, //当前页
      total: 0, //总条数
      totalPage: 0, //总页数
      size: 8, //每页大小
      tableData: [],
      options:[
        {

        }
      ],
      value:"",

      input:"",
      
    };
  },
  methods: {

   divTime(){},
    //分页
    findByPage() {
      axios
        .get(
          commons.baseUrl +
            "gradedean/noDivInfo?page=" +
            this.currentPage +
            "&size=" +
            this.size
        )
        .then((res) => {
          this.tableData = res.data.datas;
          console.log(res);
          this.total = res.data.total;
          this.totalPage = res.data.totalPage;
          this.currentPage = res.data.currentPage;
          this.size = res.data.size;
        });
    },

    //下一页
    next() {
      this.currentPage = this.currentPage + 1;
      axios
        .get(
          commons.baseUrl +
            "gradedean/noDivInfo?page=" +
            this.currentPage +
            "&size=" +
            this.size
        )
        .then((res) => {
          this.tableData = res.data.datas;
          console.log(res);
          this.total = res.data.total;
          this.totalPage = res.data.totalPage;
          this.currentPage = res.data.currentPage;
          this.size = res.data.size;
        });
    },

    //上一页
    prev() {
      this.currentPage = this.currentPage - 1;
      axios
        .get(
          commons.baseUrl +
            "gradedean/noDivInfo?page=" +
            this.currentPage +
            "&size=" +
            this.size
        )
        .then((res) => {
          this.tableData = res.data.datas;
          console.log(res);
          this.total = res.data.total;
          this.totalPage = res.data.totalPage;
          this.currentPage = res.data.currentPage;
          this.size = res.data.size;
        });
    },
  },
  mounted() {
    //axios  get请求
    //调用方法获取第一页数据
    this.findByPage();
  },
  computed: {},
};
</script>
<style scoped></style>

